# 作者：石吴震
# 2024年12月31日09时19分11秒
# 474160957@qq.com


class Dog(object):

    def __init__(self, name):
        self.name = name

    def game(self):
        print("%s 蹦蹦跳跳的玩耍..." % self.name)


class XiaoTianDog(Dog):

    def game(self):
        print("%s 飞到天上去玩耍..." % self.name)

class Person():
    def __init__(self, name):
        self.name = name

    def play_with_dog(self, dog: Dog):  #这里dog是*形参*
        print("%s 正在和 %s 玩耍..." % (self.name, dog.name))
        dog.game()

if __name__ == '__main__':
    zhang = Person('zhang')
    wangcai = Dog('旺财')
    zhang.play_with_dog(wangcai)
    xiaotianquan = XiaoTianDog('哮天犬')
    zhang.play_with_dog(xiaotianquan)
